package com.junchenrobot.mes.manager;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 络筒机管理器
 *
 * @author SeaWave
 * @date 2022/12/14
 */
@Slf4j
@Component
public class WinderManager {
    
    //private final AgvWorkDao agvWorkDao;
    //
    //private final WinderHandler winderHandler;
    //
    //@Autowired
    //public WinderManager(AgvWorkDao agvWorkDao, WinderHandler winderHandler) {
    //    this.agvWorkDao = agvWorkDao;
    //    this.winderHandler = winderHandler;
    //}
    //
    //
    ///**
    // * 络筒机准备好了
    // *
    // * @param winderId 络筒机id
    // * @param offset   偏移量
    // */
    //@Retryable(include = {TaskRunningException.class, NullPointerException.class}, maxAttempts = 100, backoff = @Backoff(delay = 3000L, multiplier = 1))
    //public void winderReady(Long winderId, int offset) {
    //    // 循环读取当前值 是否为3
    //    AgvWork agvWork = agvWorkDao.getAgvWork(winderId);
    //    log.info("循环读取值 {}", agvWork.getStatus());
    //    if (agvWork.getStatus() >= 3) {
    //        log.info("偏移量{}", offset);
    //        boolean isReady = winderHandler.winderReady(offset);
    //        if (!isReady) {
    //            throw new NullPointerException();
    //        } else {
    //            log.info("丝到位");
    //        }
    //    } else {
    //        throw new NullPointerException();
    //    }
    //}
    //
    //
    ///**
    // * 络筒机推
    // *
    // * @param offset 抵消
    // */
    //@Retryable(include = {TaskRunningException.class, NullPointerException.class}, maxAttempts = 100, backoff = @Backoff(delay = 3000L, multiplier = 1))
    //public void winderPush(int offset) {
    //    // 手动推杆当读到手动下发任务时 才进行推丝动作
    //    log.info("开始推丝");
    //    boolean push = winderHandler.winderPush(offset);
    //    if (!push) {
    //        throw new NullPointerException();
    //    } else {
    //        log.info("推杆完成");
    //    }
    //}
    //
    //@Retryable(include = {TaskRunningException.class, NullPointerException.class}, maxAttempts = 100, backoff = @Backoff(delay = 3000L, multiplier = 1))
    //public void starting(int poleName) {
    //    winderHandler.start(poleName);
    //}
    //
    
}
